package org.flexthinker.binding.value.support
{
    import org.flexthinker.binding.value.EqualsCapableObject;
    import org.flexthinker.binding.value.ValueChangeDetector;

    /**
     *  An implementation of ValueChangeDetector that provides the same semantics as X == Y
     */
    public class EqualsValueChangeDetector implements ValueChangeDetector
    {
        public function EqualsValueChangeDetector()
        {
        }


        public function hasValueChanged( oldValue:Object, newValue:Object ):Boolean
        {
            return !(oldValue == newValue ||
                    (oldValue != null && oldValue is EqualsCapableObject && oldValue.equals( newValue )));
        }
    }
}